﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<title>登陆 - {:seo('title')}</title>
	<link rel="stylesheet" href="/static/user/login/css/style.css" />
	<link rel="stylesheet" href="/static/user/login/css/icon.css" />
        <link rel="stylesheet" href="/static/hqui/libs/layui/css/layui.css">
</head>

<body>
<div id="wrapper">
	<div class="aw-login-box">
    	<div class="box-bg-ys"></div>
		<div class="mod-body clearfix">
			<div class="content pull-left">
                            <h1 class="logo" style="background:url('{:seo('logo')}') no-repeat;width:340px;height:77px;"><a href="/"></a></h1>
                                <form id="login_form" class="layui-form" action="{:url('user/index/login')}" method="post">
					<input type="hidden" name="return_url" value="0">
					<ul>
						<li>
							<input type="number" id="username" class="form-control" placeholder="手机号码" name="mobile" autocomplete="off">
						</li>
						<li>
							<input type="password" id="password" class="form-control" placeholder="密码" name="password">
						</li>
						<!-- <li class="alert alert-danger hide error_message">
							<i class="icon icon-delete"></i> <em></em>
						</li> -->
						<li class="last">
                                                        <button class="pull-right btn btn-large btn-primary" lay-submit lay-filter="login"/>登 录</button>
							<label>
                                                            <input type="checkbox" name="remember_user" id="remember_user" checked title="记住密码">
							</label>
						</li>
					</ul>
				</form>
			</div>
			<div class="side-bar pull-left">
				<a class="btn btn-block btn-qq"> <i class="icon icon-wechat"></i> 微信扫一扫登陆</a>
                                <img src="/static/wechat/qr.jpg" width="165">
			</div>
		</div>
		<div class="mod-footer">
			{:seo('copyright')}
		</div>
	</div>
</div>
</body>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/jquery.cookie.js"></script>
<script src="/static/hqui/libs/layui/layui.js"></script>
<script>
    layui.use(['layer', 'form', 'jquery'], function(){
        var layer = layui.layer,
            form  = layui.form,
            $     = layui.jquery;

        form.on('submit(login)', function(data) {
            var index = layer.msg('登录中，请稍候', {
                icon: 16,
                time: false,
                shade: 0.3
            });
            if ($("#remember_user").prop("checked") == true) {
                    var user_name = $("#username").val();
                    var user_password = $("#password").val();
                    $.cookie("remember_user", "true", {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
                    $.cookie("user_name", user_name, {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
                    $.cookie("user_password", user_password, {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
            } else {
                    $.cookie("remember_user", "false", {
                            expires: -1
                    }); // 删除 cookie
                    $.cookie("user_name", '', {
                            expires: -1
                    });
                    $.cookie("user_password", '', {
                            expires: -1
                    });
            }
            $.ajax({
                url: data.form.action,
                type: data.form.method,
                dataType: 'json',
                data: $(data.form).serialize(),
                success: function(result) {
                    if (result.code === 1) {
                        location.href = result.url;
                    } else {
                        $('.captcha img').attr('src', '{:url("user/index/captcha")}?rand='+Math.random());
                        layer.close(index);
                        layer.msg(result.msg);
                    }
                },
                error: function (xhr, state, errorThrown) {
                    layer.close(index);
                    layer.msg(state + '：' + errorThrown);
                }
            });

            return false;
        });
        //

    });

</script>
<script>
    $(function() {
        if ($.cookie("remember_user")) {
                $("#remember_user").prop("checked", true);
                $("#username").val($.cookie("user_name"));
                $("#password").val($.cookie("user_password"));
                // 输入框内容变化按钮颜色发生变化
                $(".form-data input").siblings("label").hide();
                $(".log-btn").removeClass("off")
        }
});

function saveUserInfo() {

}
</script>
</html>